const HtmlWebpackPlugin = require('html-webpack-plugin');
// const HappyPack = require('happypack');

module.exports = {
  entry: {
    index: './src/index.js',
    other: './src/other.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        // use: ['happypack/loader'],
        use: {
          loader: 'babel-loader?cacheDirectory',
        },
        exclude: /node_modules/
      },
    ]
  },
  plugins : [
    new HtmlWebpackPlugin({
      template: './src/html/index.html',
      filename: 'index.html',
      chunks:['index','vendor','common']
    }),
    new HtmlWebpackPlugin({
      template: './src/html/other.html',
      filename: 'other.html',
      chunks: ['other','common']
    }),
    // new HappyPack({
    //   loaders:['babel-loader?cacheDirectory']
    // })
  ]
}